package org.yohann.ai.controller;

import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.yohann.ai.annotation.GetJson;
import org.yohann.ai.annotation.GetStream;
import org.yohann.ai.service.RecommendService;
import reactor.core.publisher.Flux;

@RestController
@CrossOrigin("*")
@AllArgsConstructor
@RequestMapping("/api")
public class RecommendController {

    private final RecommendService recommendService;

    @GetJson("/recommend-view/{userId}")
    public String recommendView(@PathVariable String userId) {
        return recommendService.getViewSuggestion(userId);
    }

    @GetStream("/recommend-sales")
    public Flux<String> recommendSales(@RequestParam String userId) {
        return recommendService.getSalesSuggestion(userId);
    }
}